<!--分页-->
<template>
  <el-pagination
    :page-size.sync="crudInstance.page.size"
    :total="crudInstance.page.total"
    :current-page.sync="crudInstance.page.page"
    style="margin-top: 8px;"
    layout="total, prev, pager, next, sizes"
    @size-change="sizeChangeHandler"
    @current-change="pageChangeHandler"
  />
</template>
<script>
import { pagination } from '@crud/crud'
export default {
  mixins: [pagination()],
  props: {
    crudInstance: { // 接收外部传入的CRUD实例
      type: Object,
      required: true
    }
  },
  methods: {
    sizeChangeHandler(size) {
      this.crudInstance.sizeChangeHandler(size)
    },
    pageChangeHandler(page) {
      this.crudInstance.pageChangeHandler(page)
    }
  }
}
</script>
